#16 new
leprechaun

task.php in command line => wrong argv assumptions

Reported by leprechaun | March 13th, 2009 @ 11:45 AM

task.php assumes that $_SERVER[ 'argv' ][ 0 ] is a numeric ID of a task to run. In actuality, it's the script that is being run ...

$:php task.php

ARGV == array ( 0 => 'task.php' )

Here is a replacement for the end of task.php which corrects this, and add type checking

if( !empty( $VAR[ 'id' ] ) && is_numeric( $VAR[ 'id' ] ) ) {

$task->id = $VAR[ 'id' ];

} else if( isset( $SERVER[ 'argv' ] ) && count( $SERVER[ 'argv' ] ) > 1 && isset( $SERVER[ 'argv' ][ 1 ] ) && is_numeric( $SERVER[ 'argv' ][ 1 ] ) ) {

$task->id = $_SERVER[ 'argv'][ 1 ];

}

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Open Source Billing, Invoicing, and Provisioning

People watching this ticket

Pages